package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teaching.domain.vo.PlatformFForumVO;
import com.ruoyi.teaching.service.PlatformFLikeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2024-10-14
 */
@RestController
@RequestMapping("/platform/like")
@Api(tags = "platform-f-点赞管理")
public class PlatformFLikeController {
    @Autowired
    private PlatformFLikeService platformFLikeService;

    /**
     *新增点赞
     */
    @PostMapping("/addLike")
    @ApiOperation(value = "新增点赞", notes = "新增点赞")
    @Log(title = "【新增点赞】", businessType = BusinessType.INSERT)
    public AjaxResult addForumComment(Long objectId) {
        return platformFLikeService.addForumComment(objectId);
    }

    /**
     * 删除点赞
     */
    @DeleteMapping("/delete/{ids}")
    @ApiOperation(value = "删除点赞", notes = "删除点赞")
    @Log(title = "删除点赞", businessType = BusinessType.DELETE)
    public AjaxResult deleteForumComment(@PathVariable("ids") Long[] ids) {
        return platformFLikeService.delete(ids);
    }

    /**
     * 取消点赞
     */
    @DeleteMapping("/deleteLike/{ids}")
    @ApiOperation(value = "取消点赞", notes = "取消点赞")
    @Log(title = "取消点赞", businessType = BusinessType.DELETE)
    public AjaxResult deleteLikeComment(@PathVariable("ids") Long[] ids) {
        return platformFLikeService.deleteLikeComment(ids);
    }

    /**
     * 分页获取个人点赞数据
     */
    @GetMapping("/personal")
    @ApiOperation(value = "分页获取个人点赞数据", notes = "分页获取个人点赞数据")
    public AjaxResult getPersonalLikeList(Integer pageNum, Integer pageSize, Integer type) {
        return platformFLikeService.getPersonalLikeList(pageNum, pageSize, type);
    }

}

